package util;

import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.InputStream;
import java.io.OutputStream;

public class Upload {
    public static void uploadFile(File file,String savePath,String FileName) throws Exception{
    	 OutputStream os = new FileOutputStream(new File(savePath,FileName));  
         
         InputStream is = new FileInputStream(file);  
           
         byte[] buf = new byte[1024];  
         int length = 0 ;  
           
         while(-1 != (length = is.read(buf) ) )  
         {  
             os.write(buf, 0, length) ;  
         }  
         is.close();  
         os.close();  
    }
    
    public static String getFileType(String FileName){
    	String FileType=null;
    	FileType=FileName.substring(FileName.lastIndexOf(".")+1, FileName.length());
    	return FileType;
    }
}
